agint <- ag %>% mutate(treat=dplyr::recode(treat, '1' = 0,'2' = 1, '3' = 3, '4'=4))

agint <- agint[agint$state !="NJ",]

agint <- agint %>%
	mutate(trumptercile = ntile(two_party_trump_pct, 3))
agint$trumptercile <- as.factor(agint$trumptercile)


out <- interflex(Y = "yes", D = "treat", X = "two_party_trump_pct", data = agint, estimator = "kernel", nboots = 200, parallel = TRUE, cores = 4)

interflex_plot <- out$figure +
	theme(panel.spacing = unit(1, "lines")) + 
	theme(panel.grid.major = element_line(colour = "white"),panel.grid.minor = element_line(colour = "white"), axis.title.x = element_text(vjust=-0.5)) +
	xlab("Trump Two-Party Vote % in County") +
	ylab("Marginal Effect of Ranking Treatment on\nAgreeing to Discuss Collaboration ") 

ggsave(plot = interflex_plot, "results/interflex_trump_plot.pdf", width=5, height=5)